#pragma once
#include "cgzCTcpC.h"

using namespace boost::asio;
using ip::tcp;

class cgzCTcpAsioC;

class cgzCTcpAsioC : public cgzCTcpC
{
public:
    cgzCTcpAsioC(
        cgzCThreadPool *pool,
        const char *name,
        const std::string ip,
        const int port,
        const int cid);
    virtual ~cgzCTcpAsioC();

public:
    void do_tgoing();

public:
    bool run(int64_t nms) override;

public:
    bool tcpinit() override;

protected:
    bool tcplink() override;
    bool tcpread() override;
    bool tcpsend() override;

private:
    io_context *m_io_context;
    tcp::socket *m_socket;
    tcp::resolver::results_type m_endpoints;
};
